package com.irdstudio.bsp.executor.core.plugin.migrate;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import com.irdstudio.bsp.executor.core.plugin.AbstractPlugin;
import com.irdstudio.bsp.executor.core.plugin.migrate.dao.MigrateCheckRule;
import com.irdstudio.bsp.executor.core.plugin.migrate.dao.MigrateCheckRuleDao;

/**
 * 迁移校验规则插件,实现迁移规则的执行并记录结果
 * @author ligm
 *
 */
public class MigrateCheckRulePlugin extends AbstractPlugin {
	/**检查规则配置*/
	private List<MigrateCheckRule> migrateCheckRuleList=null;
	@Override
	public boolean execute() {
		// TODO Auto-generated method stub
		migrateCheckRuleUtil ruleUtil=new migrateCheckRuleUtil();
		boolean result = ruleUtil.MigrateCheckRulerrz(migrateCheckRuleList, this.getPluginConnection());
		return result;
	}

	@Override
	protected boolean doReadConfigureFromDB(Connection conn, String szConfIdentify) throws SQLException {
		// TODO Auto-generated method stub
		String subsCode=szConfIdentify;
		MigrateCheckRuleDao migrateCheckRuleDao=new MigrateCheckRuleDao(conn);
		String ifstr=" where subs_code= '"+subsCode+"'";
		migrateCheckRuleList=migrateCheckRuleDao.queryMigrateCheckRuleWithCond(ifstr,"");
		return true;
	}

}
